/**************************************************************************
 *         Copyright(c) 2007 by Sunplus mMedia  Technology Co., Ltd.       *
 *                                                                         *
 *  This software is copyrighted by and is the property of Sunplus mMedia  *
 *  Technology Co., Ltd. All rights are reserved by Sunplus mMedia Techno- *
 *  logy Co., Ltd. This software may only be used in accordance with the   *
 *  corresponding license agreement. Any unauthorized use, duplication,    *
 *  distribution, or disclosure of this software is expressly forbidden.   *
 *                                                                         *
 *  This Copyright notice "M U S T" not be removed or modified without     *
 *  prior written consent of Sunplus mMedia Technology  Co., Ltd.          *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd. reserves the right to modify this  *
 *  software without notice.                                               *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd.                                    *
 *  19-1, Innovation First Road, Science-Based Industrial Park,            *
 *  Hsin-Chu, Taiwan, R.O.C.                                               *
 *                                                                         *
 **************************************************************************/
#ifndef __SIDCINIT_H__
#define __SIDCINIT_H__
#include "general.h"
//---- PIMA 15740 Datatype Code ------
#define K_PIMATYP_UNDEF                         0x0000
#define K_PIMATYP_INT8                          0x0100
#define K_PIMATYP_UINT8                         0x0200
#define K_PIMATYP_INT16                         0x0300
#define K_PIMATYP_UINT16                        0x0400
#define K_PIMATYP_INT32                         0x0500
#define K_PIMATYP_UINT32                        0x0600
#define K_PIMATYP_INT64                         0x0700
#define K_PIMATYP_UINT64                        0x0800
#define K_PIMATYP_INT128                        0x0900
#define K_PIMATYP_UINT128                       0x0a00
#define K_PIMATYP_AINT8                         0x0140
#define K_PIMATYP_AUINT8                        0x0240
#define K_PIMATYP_AINT16                        0x0340
#define K_PIMATYP_AUINT16                       0x0440
#define K_PIMATYP_AINT32                        0x0540
#define K_PIMATYP_AUINT32                       0x0640
#define K_PIMATYP_AINT64                        0x0740
#define K_PIMATYP_AUINT64                       0x0840
#define K_PIMATYP_AINT128                       0x0940
#define K_PIMATYP_AUINT128                      0x0a40
#define K_PIMATYP_STR                           0xffff
                                                     
//---- PIMA 15740 Operation Code ------
#define K_PIMAOPE_Undefined                     0x0010
#define K_PIMAOPE_GetDeviceInfo                 0x0110
#define K_PIMAOPE_OpenSession                   0x0210
#define K_PIMAOPE_CloseSession                  0x0310
#define K_PIMAOPE_GetStorageIDs                 0x0410
#define K_PIMAOPE_GetStorageInfo                0x0510
#define K_PIMAOPE_GetNumObjects                 0x0610
#define K_PIMAOPE_GetObjectHandles              0x0710
#define K_PIMAOPE_GetObjectInfo                 0x0810
#define K_PIMAOPE_GetObject                     0x0910
#define K_PIMAOPE_GetThumb                      0x0a10 
#define K_PIMAOPE_DeleteObject                  0x0b10
#define K_PIMAOPE_SendObjectInfo                0x0c10
#define K_PIMAOPE_SendObject                    0x0d10
#define K_PIMAOPE_InitiateCapture               0x0e10
#define K_PIMAOPE_FormatStore                   0x0f10
#define K_PIMAOPE_ResetDevice                   0x1010
#define K_PIMAOPE_SelfTest                      0x1110
#define K_PIMAOPE_SetObjectProtection           0x1210
#define K_PIMAOPE_PowerDown                     0x1310
#define K_PIMAOPE_GetDevicePropDesc             0x1410
#define K_PIMAOPE_GetDevicePropValue            0x1510
#define K_PIMAOPE_SetDevicePropValue            0x1610
#define K_PIMAOPE_ResetDevicePropValue          0x1710
#define K_PIMAOPE_TerminateOpenCapture          0x1810
#define K_PIMAOPE_MoveObject                    0x1910
#define K_PIMAOPE_CopyObject                    0x1a10
#define K_PIMAOPE_GetPartialObject              0x1b10
#define K_PIMAOPE_InitiateOpenCapture           0x1c10
                                                      
//---- PIMA 15740 Response Code -------
#define K_PIMARES_Undefined                     0x0020
#define K_PIMARES_OK                            0x0120
#define K_PIMARES_GeneralError                  0x0220
#define K_PIMARES_SessionNotOpen                0x0320
#define K_PIMARES_InvalidTransactionID          0x0420
#define K_PIMARES_OperationNotSupported         0x0520
#define K_PIMARES_ParameterNotSupported         0x0620
#define K_PIMARES_IncompleteTransfer            0x0720
#define K_PIMARES_InvalidStorageID              0x0820
#define K_PIMARES_InvalidObjectHandle           0x0920
#define K_PIMARES_DevicePropNotSupported        0x0a20
#define K_PIMARES_InvalidObjectFormatCode       0x0b20
#define K_PIMARES_StoreFull                     0x0c20 
#define K_PIMARES_ObjectWriteProtected          0x0d20
#define K_PIMARES_StoreReadOnly                 0x0e20
#define K_PIMARES_AccessDenied                  0x0f20
#define K_PIMARES_NoThumbnailPresent            0x1020
#define K_PIMARES_SelfTestFailed                0x1120
#define K_PIMARES_PartialDeletion               0x1220 
#define K_PIMARES_StoreNotAvailable             0x1320 
#define K_PIMARES_SpecByFormatUnsupported       0x1420
#define K_PIMARES_NoValidObjectInfo             0x1520
#define K_PIMARES_InvalidCodeFormat             0x1620
#define K_PIMARES_UnknownVendorCode             0x1720
#define K_PIMARES_CaptureAlreadyTerminated      0x1820
#define K_PIMARES_DeviceBusy                    0x1920
#define K_PIMARES_InvalidParentObject           0x1a20
#define K_PIMARES_InvalidDevicePropFormat       0x1b20
#define K_PIMARES_InvalidDevicePropValue        0x1c20
#define K_PIMARES_InvalidParameter              0x1d20
#define K_PIMARES_SessionAlreadyOpen            0x1e20
#define K_PIMARES_TransactionCancelled          0x1f20
#define K_PIMARES_SpecOfDestinationUnsupported  0x2020

//---- PIMA 15740 Object Format Code -------
#define K_PIMAOBJ_AncillaryUndefined            0x0030
#define K_PIMAOBJ_Association                   0x0130
#define K_PIMAOBJ_Script                        0x0230
#define K_PIMAOBJ_Executable                    0x0330
#define K_PIMAOBJ_Text                          0x0430
#define K_PIMAOBJ_HTML                          0x0530
#define K_PIMAOBJ_DPOF                          0x0630
#define K_PIMAOBJ_AIFF                          0x0730
#define K_PIMAOBJ_WAV                           0x0830
#define K_PIMAOBJ_MP3                           0x0930
#define K_PIMAOBJ_AVI                           0x0a30
#define K_PIMAOBJ_MPEG                          0x0b30
#define K_PIMAOBJ_ASF                           0x0c30
#define K_PIMAOBJ_ImageUndefined0               0x0038
#define K_PIMAOBJ_EXIF_JPEG                     0x0138
#define K_PIMAOBJ_TIFF_EP                       0x0238
#define K_PIMAOBJ_FlashPix                      0x0338
#define K_PIMAOBJ_BMP                           0x0438
#define K_PIMAOBJ_CIFF                          0x0538
#define K_PIMAOBJ_ImageUndefined1               0x0638
#define K_PIMAOBJ_GIF                           0x0738
#define K_PIMAOBJ_JFIF                          0x0838
#define K_PIMAOBJ_PCD                           0x0938
#define K_PIMAOBJ_PICT                          0x0a38
#define K_PIMAOBJ_PNG                           0x0b38
#define K_PIMAOBJ_ImageUndefined2               0x0c38
#define K_PIMAOBJ_TIFF                          0x0d38
#define K_PIMAOBJ_TIFF_IT                       0x0e38
#define K_PIMAOBJ_JP2                           0x0f38
#define K_PIMAOBJ_JPX                           0x1038
                                                      
//---- PIMA 15740 Event Code -------
#define K_PIMAEVE_Undefined                     0x0040
#define K_PIMAEVE_CancelTransaction             0x0140
#define K_PIMAEVE_ObjectAdded                   0x0240
#define K_PIMAEVE_ObjectRemoved                 0x0340
#define K_PIMAEVE_StoreAdded                    0x0440
#define K_PIMAEVE_StoreRemoved                  0x0540
#define K_PIMAEVE_DevicePropChanged             0x0640
#define K_PIMAEVE_ObjectInfoChanged             0x0740
#define K_PIMAEVE_DeviceInfoChanged             0x0840
#define K_PIMAEVE_RequestObjectTransfer         0x0940
#define K_PIMAEVE_StoreFull                     0x0a40
#define K_PIMAEVE_DeviceReset                   0x0b40
#define K_PIMAEVE_StorageInfoChanged            0x0c40
#define K_PIMAEVE_CaptureComplete               0x0d40
#define K_PIMAEVE_UnreportedStatus              0x0e40
                                                      
//---- PIMA 15740 Device Property Code -------
#define K_PIMADEV_Undefined                     0x0050
#define K_PIMADEV_BatteryLevel                  0x0150
#define K_PIMADEV_FunctionMode                  0x0250
#define K_PIMADEV_ImageSize                     0x0350
#define K_PIMADEV_CompressionSetting            0x0450
#define K_PIMADEV_WhiteBalance                  0x0550
#define K_PIMADEV_RGBGain                       0x0650
#define K_PIMADEV_F-Number                      0x0750
#define K_PIMADEV_FocalLength                   0x0850
#define K_PIMADEV_FocusDistance                 0x0950
#define K_PIMADEV_FocusMode                     0x0a50
#define K_PIMADEV_ExposureMeteringMode          0x0b50
#define K_PIMADEV_FlashMode                     0x0c50 
#define K_PIMADEV_ExposureTime                  0x0d50
#define K_PIMADEV_ExposureProgramMode           0x0e50
#define K_PIMADEV_ExposureIndex                 0x0f50
#define K_PIMADEV_ExposureBiasCompensation      0x1050
#define K_PIMADEV_DateTime                      0x1150
#define K_PIMADEV_CaptureDelay                  0x1250 
#define K_PIMADEV_StillCaptureMode              0x1350
#define K_PIMADEV_Contrast                      0x1450
#define K_PIMADEV_Sharpness                     0x1550
#define K_PIMADEV_DigitalZoom                   0x1650
#define K_PIMADEV_EffectMode                    0x1750
#define K_PIMADEV_BurstNumber                   0x1850
#define K_PIMADEV_BurstInterval                 0x1950
#define K_PIMADEV_TimelapseNumber               0x1a50
#define K_PIMADEV_TimelapseInterval             0x1b50
#define K_PIMADEV_FocusMeteringMode             0x1c50
#define K_PIMADEV_UploadURL                     0x1d50
#define K_PIMADEV_Artist                        0x1e50
#define K_PIMADEV_CopyrightInfo                 0x1f50
#define K_PIMADEV_All                           0xffff

//wangjg++20081103
#define K_InDataGetMask 		      0x40
#define K_InDataGetHandles_SIDC 	0x40
#define K_InDataGetObjInfo_SIDC        0x41
#define K_InDataGetThumb_SIDC          0x42
#define K_InDataGetObject_SIDC		0x43
#define K_InDataGetPartial_SIDC         0x44
//#define K_OutDataDelete_SIDC		0x48
#define K_OutDataSendObjInfo_SIDC	0x49
#define K_OutDataSendObject_SIDC	0x4a


// USB
#define K_SIDC_USB_VERSION_2_0 1
extern xdata UINT8 G_bUSBSpeed;
#if K_SIDC_USB_VERSION_2_0
//	#define K_USBSIDC_BULK_SIZE_MAX	512
#else
//	#define K_USBSIDC_BULK_SIZE_MAX	64
#endif
#define K_USBSIDC_BULK_SIZE_MAX   (G_bUSBSpeed?512:64)

//SIDC
#define K_USBSIDC_CONTAINER_SIZE        0x000c//sizeof(USBSIDC_CONTAINER)    //not counting paramteter size
#define K_USBSIDC_ParamCount                    3
typedef struct _USBSIDC_CONTAINER
{
        UINT32   ulContainerLength;
        UINT16  usContainerType;
        UINT16  usCode;
        UINT32   ulTransactionId;
        UINT32   ulParameter[K_USBSIDC_ParamCount];
} USBSIDC_CONTAINER, *PUSBSIDC_CONTAINER;

#define SIDC_FILE_NODE_SIZE ((UINT16)sizeof(SIDC_FILE_NODE))
typedef struct _SIDC_FILE_NODE
{
	UINT32 handle;
	UINT8 fileName[13];
	UINT16 fileType;
	UINT32 fileSize;
	UINT8 reserved;
}SIDC_FILE_NODE,*PSIDC_FILE_NODE;

typedef struct _STR0x00
{
        UINT8   numChars;
} STR0x00, *PSTR0x00;

typedef struct _STR0x08
{
        UINT8   numChars;
        UINT16  stringChars[0x08];
} STR0x08, *PSTR0x08;

typedef struct _STR0x10
{
        UINT8   numChars;
        UINT16  stringChars[0x10];
} STR0x10, *PSTR0x10;

typedef struct _STR0x18
{
        UINT8   numChars;
        UINT16  stringChars[0x18];
} STR0x18, *PSTR0x18;

typedef struct _STR0x20
{
        UINT8   numChars;
        UINT16  stringChars[0x20];
} STR0x20, *PSTR0x20;


#endif /*__SIDCINIT_H__*/
